<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/css.css">
</head>

<body>
    <div class="tpt-login">
        <h2>登陆页面</h2>
        <form>
            <input type="text" name="name" placeholder="请输入账号">
            <input type="password" name="password" placeholder="请输入密码">
            <p>
                <span><i></i></span>我已阅读并同意
                <a href="#" target="_blank"> 会员登陆协议</a>
            </p>
            <!-- <button>立即登录</button> -->
            <input type="submit" value="登录">
        </form>
    </div>
    <script src="../jquery/jquery-1.12.4.min.js"></script>
    <script>
        $('input[type="submit"]').on('click', (e) => {

            e.preventDefault();
            $.ajax({
                method: 'post',
                url: 'http://localhost:3000/denglu',
                data: {
                    name: $('input[type="text"]').eq(0).val(),
                    password: $('input[type="password"]').eq(0).val()
                },
                success: (data) => {
                    console.log(data);
                },
                error: (err) => {
                    console.log(err);
                }
            })
        })
    </script>
</body>

</html>